package test;

public class CartePrepayer {
	
	private int credit;
	private Telephone tel;
	private Smartphone smart; 
	
	public CartePrepayer(int credit){
		this.credit=credit;
	}
	
	public int getCredit() {
		return credit;
	}

	public void setCredit(int credit) {
		this.credit = credit;
	}
	
	public int  calculerCredit_Telephone(){
		if(tel.envoyerMessage()){
			credit = credit-5;
		}
		else{
			if(tel.appeler()){
				credit=credit-10;
			}
		}	
		return credit;
	}
	
	public int calculerCredit_Smartphone(){
		if(smart.envoyerMessage()){
			credit = credit-5;
		}
		else{
			if(smart.appeler()){
				credit=credit-10;
			}
			else{
					if(smart.Connexion_internet()){
						credit=credit-20;	
					}
			}
		}
		return credit;
	}
}
	

